import request from '@/utils/request'

// 查询学期列表
export function listSemester(query) {
  return request({
    url: '/academic/semester/list',
    method: 'get',
    params: query
  })
}

// 查询学期详细
export function getSemester(id) {
  return request({
    url: '/academic/semester/' + id,
    method: 'get'
  })
}

// 新增学期
export function addSemester(data) {
  return request({
    url: '/academic/semester',
    method: 'post',
    data: data
  })
}

// 修改学期
export function updateSemester(data) {
  return request({
    url: '/academic/semester',
    method: 'put',
    data: data
  })
}

// 删除学期
export function delSemester(id) {
  return request({
    url: '/academic/semester/' + id,
    method: 'delete'
  })
}

// 导出学期
export function exportSemester(query) {
  return request({
    url: '/academic/semester/export',
    method: 'post',
    data: query,
    responseType: 'blob'
  })
}

// 获取当前学期
export function getCurrentSemester() {
  return request({
    url: '/academic/semester/current',
    method: 'get'
  })
}

// 获取学期下拉列表
export function getSemesterOptions() {
  return request({
    url: '/academic/semester/options',
    method: 'get'
  })
}